package com.sun.dailyprj.androidx.workmanager;


import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

/*
 * =====================================================================================
 * Summary:
 *
 * File: TimerWorker.java
 * Author: Yanpeng.Sun
 * Create: 2019/6/21 13:45
 * =====================================================================================
 */
public class TimerWorker extends Worker{


    public TimerWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
        super(context, workerParams);
        Data data = this.getInputData();
    }

    @NonNull
    @Override
    public Result doWork() {
        int i = 0;
        do {
            Log.i("worker", "i=" + i);
            i++;
            try{
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } while (i < 100);
        return Result.success();

    }
}
